<?php
use think\facade\Route;

/** 无需登录 */
Route::group('teacher', function () {
    Route::get('list', '@index'); // 列表
    // Route::get('follow', '@getFollowList'); // 讲师关注的用户列表
    // Route::post('follow', '@follow'); // 关注讲师
    // Route::get('follower', '@getFollower'); // 讲师的粉丝列表
    Route::get('levellist', '@levelList'); // 讲师等级列表

    Route::group('<id>', function () {
        Route::get('basic$', '@basic');
        Route::get('course$', '@course');
    })->pattern(['id' => '\d+']);
})
    ->prefix('\app\user\service\teacher\Teacher')
    ->middleware(['withoutLogin']);

/** 关注接口 */
// Route::group('teacher', function () {
//     Route::post('follow', '@follow'); // 关注讲师
//     Route::delete('follow', '@unfollow'); // 关注讲师
//     Route::get('follow', '@getFollowList')->middleware(['withoutLogin']); // 讲师关注的用户列表
//     Route::get('follower', '@getFollower')->middleware(['withoutLogin']); // 讲师的粉丝列表
// })
//     ->prefix('\app\user\service\teacher\Follow');

/* 需要登录 */
Route::group('teacher', function () {
    Route::group('auth', function () {
        Route::get('$', '@authFetch');
        Route::post('$', '@authSubmit')->middleware(['phoneCheck']);
    });

})->prefix('\app\user\service\teacher\Teacher');

// 讲师简介渲染
Route::get('teacher/<id>/info$', 'getInfo')
    ->prefix('\app\user\logic\teacher\Teacher@')
    ->middleware(['withoutLogin'])
    ->setOption('is_api', 0);
